package com.ruoyi.order.ex;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.*;

import java.io.Serializable;
import java.time.temporal.ChronoUnit;
import java.util.Date;

/**
 * @description : TODO
 * @Author QiHainan
 * @Create 2025/8/7 16:13
 * @Version 1.0
 */
@Data
@Document(indexName = "es_product")
@Setting(shards = 1,replicas = 0)
public class EsProd implements Serializable {
    /** 商品ID */
    @Id
    @Field(type = FieldType.Integer)
    private Integer prodId;

    /** SPU */
    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String prodSpu;

    /** 商品类型 */
    @Field(type = FieldType.Keyword)
    private Long prodKind;

    /** 商品分类 */
    @Field(type = FieldType.Keyword)
    private Long prodType;

    /** 商品名称 */
    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String prodName;

    /** 商品品牌 */
    @Field(type = FieldType.Keyword)
    private Long brandId;

    /** 商品状态 */
    @Field(type = FieldType.Keyword)
    private Long prodStatus;

    /** 商品单位 */
    @Field(type = FieldType.Keyword)
    private Long unitId;

    /** 商品标签 */
    @Field(type = FieldType.Keyword)
    private Long tagId;

    /** 供应商 */
    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String appr;

    /** 缩略图 */
    @Field(type = FieldType.Text,index = false)
    private String prodImage;

    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String brandName;

    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String typeName;

    /** 创建者 */
    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String createBy;

    /** 创建时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8",shape = JsonFormat.Shape.STRING)
    @Field(type = FieldType.Date,format = DateFormat.custom,pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /** 更新者 */
    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String updateBy;

    /** 更新时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8",shape = JsonFormat.Shape.STRING)
    @Field(type = FieldType.Date,format = DateFormat.custom,pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

}
